package model

import (
	"go-project/common"
	"go-project/common/base"
	"go-project/common/base/req"
	"time"
)

type (
	User struct {
		base.Model
		Username string     `gorm:"column:username;type:varchar(255);comment:用户名" json:"username" form:"username"`
		Password string     `gorm:"column:password;type:varchar(255);comment:密码" json:"password" form:"password"`
		Age      int        `gorm:"column:age;type:int(11);common:年龄" json:"age" form:"age"`
		Birthday *time.Time `gorm:"column:birthday;type:datetime;common:生日" json:"birthday" form:"birthday"`
	}

	UserDto struct {
		User
		req.Pager
		Name *string `json:"name" form:"name"`
	}
)

func (m *User) TableName() string {
	return "user"
}

func init() {
	common.AutoMigrate = append(common.AutoMigrate, &User{})
}
